// by Xeno
#define THIS_FILE "fn_checktrucktrans.sqf"
#include "x_setup.sqf"
private ["_vehicle","_position","_enterer","_was_engineon"];

_enterer = _this select 2;
if (_enterer != player) exitWith {};

PARAMS_2(_vehicle,_position);

_was_engineon = isEngineOn _vehicle;

_exit_it = false;
#ifdef __TT__
_d_side = GV(_vehicle,GVAR(side));
if (!isNil "_d_side") then {
	if (GVAR(player_side) == blufor && {_d_side == opfor}) then {
		_exit_it = true;
		[(localize "STR_DOM_MISSIONSTRING_180"), "SIDE"] call FUNC(HintChatMsg);
	} else {
		if (GVAR(player_side) == opfor && {_d_side == blufor}) then {
			_exit_it = true;
			[(localize "STR_DOM_MISSIONSTRING_181"), "SIDE"] call FUNC(HintChatMsg);
		};
	};
};
#endif

if (!GVAR(with_ai) && {GVAR(with_ai_features) != 0} && {!_exit_it} && {!(str(_enterer) in GVAR(is_engineer))}) exitWith {
	(localize "STR_DOM_MISSIONSTRING_182") call FUNC(HQChat);
	if (!_was_engineon && {isEngineOn _vehicle}) then {
		_vehicle engineOn false;
		_enterer action ["engineOff", _vehicle];
	};
	_enterer action["Eject",_vehicle];
};
